
export default {
  ssr: true, // 是否开启服务端渲染(可插拔)
  target: 'server',
  telemetry: false,
  server: {
    port: 3010,
    host: '127.0.0.1',
  },
  env: {
    BASE_URL: 'http://127.0.0.1:3010',
    BASE_API: 'http://127.0.0.1:3010',
    npm_package_name: 'DEMO测试',
    npm_package_description: 'demo测试',
  },
  head: {
    title: process.env.npm_package_name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  css: [
    'ant-design-vue/dist/antd.css',
    '@/assets/common.css',
  ],
  plugins: [
    { src: '@/plugins/antd-ui' },
    { src: '@/plugins/axios/axios' },
    { src: '@/plugins/api' },
    { src: '@/plugins/vue-global' },
    { src: '@/plugins/lz-ui' },
    // { src: '@/plugins/mock' }, // 模拟数据测试
  ],
  components: true,
  buildModules: [
  ],
  loading: {
    color: '#1890ff',
  },
  router: {
    middleware: ['auth','permit']
  },
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/auth',
    '@nuxtjs/style-resources',
    '@nuxtjs/pwa',
    '@nuxt/content',
    '@nuxtjs/proxy',
    'cookie-universal-nuxt',
  ],
  styleResources: {
    // scss: '@/assets/variables.scss',
    less: '@/assets/variables.less',
  },
  auth: {
    strategies: {
      local: {
        endpoints: {
          login: { url: '/api/auth/login', method: 'post', propertyName: 'data.token' }, // json数据结构
          logout: { url: '/api/auth/logout', method: 'get' },
          user: { url: '/api/auth/auth', method: 'post', propertyName: 'data' }, // json数据结构
        }
      }
    },
    redirect: {
      login: '/login',
      logout: '/',
      callback: '/login',
      home: '/'
    },
    cookie: {
      options: {
        maxAge: 60 * 60 * 24 * 7 // 一周
      }
    },
    localStorage: false
  },
  axios: {
    proxy: true,
    credentials: true,
  },
  proxy: [
    [
      '/api', {
        target: 'http://192.168.1.55:3000', // 代理地址
        changeOrigin: true,
      },
    ],
    [
      '/app', {
        target: 'https://www.ucharts.cn', // 代理地址
        changeOrigin: true,
        pathRewrite: {
            '^/app': ''
        }
      },
    ],
    [
      '/v1', {
        target: 'https://api.xinminghui.com', // 代理地址
        changeOrigin: true,
      },
    ]
  ],
  content: {},
  build: {
    vendor: ['axios'],
  }
}
